/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.me.ttvdroid;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TextView;
import java.util.Calendar;
import java.util.GregorianCalendar;
import org.me.utils.CalendarReader;

/**
 *
 * @author bertram
 */
public class SyncView extends Activity{
    TextView text;
    
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sync);
        final ScrollView scroll = (ScrollView)findViewById(R.id.ScrollView01);
        text = (TextView) findViewById(R.id.text);
        final Button button = (Button)findViewById(R.id.button);
        final Button b2 = (Button)findViewById(R.id.button2);
        b2.setEnabled(false);
        text.setText("");

         button.setOnClickListener(new OnClickListener(){
            public void onClick(View v) {
                CalendarReader reader = new CalendarReader(handler);
                Calendar today = new GregorianCalendar();
                
                reader.start();

            }
        });

    }

     final Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            CharSequence day =  msg.getData().getCharSequence("day");
            text.append(day);
            if(day.equals("done"));
            {
                Button b = (Button)findViewById(R.id.button);
                Button b2 = (Button)findViewById(R.id.button2);
                b.setEnabled(false);
                b2.setEnabled(true);

            }


        }
    };


}
